/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package vistas;

import java.math.BigDecimal;

/**
 *
 * @author g
 */
public class Utils {
    
    public static boolean EsUnNumeroEnteroPositivo(String n){
        return (n.matches("[+]?\\d*(\\\\d+)?") && n.equals("") == false);
    }
    
    public static String redondearNumero(double nro, int dig){
        BigDecimal n = new BigDecimal(nro);
        BigDecimal setScale = n.setScale(dig, BigDecimal.ROUND_HALF_UP);
        return setScale.toString();
    }
    
}
